package basics.day18.ArrayList.IteratorDemo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        fun_1();
    }

    public static void fun_1() {
        Collection<String> c = new ArrayList<String>();
        c.add("张喜");
        c.add("张喜1");
        c.add("张2");
        c.add("张喜3");

        Iterator<String> i = c.iterator();
        boolean b = i.hasNext();
        System.out.println(b);
        String s = i.next();
        System.out.println(s);

        System.out.println("============");

        Iterator<String> i1 = c.iterator();
        while (true){
            boolean b1 = i1.hasNext();
            if(!b1) break;
            System.out.println(i1.next());
        }
    }
}
